import { request }  from '@/axios/request'


//获取流水编码

export const CreateCode = () => {
    return request({
        url: '/CashFlow/CreateCode',
        method: 'get'
    })
}

//单个获取
export const GetOne = (parmas) => {
    return request({
        url: '/CashFlow/Get',
        method: 'get',
        data: {"Id": parmas}
    })
}

// 列表查询接口
export const GetList = (parmas) => {
    return request({
        url: '/CashFlow/EntityList',
        method: 'post',
        data: parmas
    });
}

//分页查询
export const GetListByPage = (parmas) => {
    return request({
        url: '/CashFlow/ListByPage',
        method: 'get',
        data: parmas
    });
}

export const Create = (parmas) => {
    //console.log('>>>>>>>>>CashFlowAPICreate',parmas)
    return request({
        url: '/CashFlow/Create',
        method: 'post',
        data: parmas
    })
}

export const DeleteSingle = (parmas) => {
    return request({
        url: '/CashFlow/DeleteSingle',
        method: 'delete',
        data: { "Id": parmas }
    })
}

export const DeleteList = (parmas) => {
    return request({
        url: '/CashFlow/DeleteList',
        method: 'patch',
        data: JSON.stringify(parmas)
    })
}

export const Update = (parmas) => {
    return request({
        url: '/CashFlow/Update',
        method: 'put',
        data: { "entity": parmas,"Id": parmas.Id}
    })
}

export const BatchImport = (parmas) => {
    console.log(parmas);
    return request({
        url: '/CashFlow/ImportData',
        method: 'get',
        data: parmas
    })
}

export const DeleteUploadFile = (parmas) => {
    return request({
        url: '/CashFlow/DeleteUploadFile',
        method: 'delete',
        data: {"UploadFile": parmas}
    })
}

export const QueryBankInfo = (parmas) => {
    return request({
        url: '/Bank/QueryCashFlowBank',
        method: 'get',
        data: { "BankNameOrBankTail": parmas }
    })
}

export const QueryProjectInfo = (parmas) => {
    return request({
        url: '/Project/QueryCashFlowProject',
        method: 'get',
        data: { "ProjectNameOrProjectTail": parmas }
    })
}

//通过银行ID查询银行
export const QueryBankById = (parmas) => {
    return request({
        url: '/Bank/Get',
        method: 'get',
        data: { "Id": parmas }
    })
}

//通过项目ID查询项目
export const QueryProjectById = (parmas) => {
    return request({
        url: '/Project/Get',
        method: 'get',
        data: { "Id": parmas }
    })
}

//加载银行类型
export const LoadBankType = () => {
    return request({
        url: '/BankType/EntityList',
        method: 'get'
    });
}

//加载工程类型
export const LoadProjectType = () => {
    return request({
        url: '/ProjectType/EntityList',
        method: 'get'
    });
}

//加载款项类型
export const LoadFundsType = () => {
    return request({
        url: '/FundsType/EntityList',
        method: 'get'
    });
}

//加载人员信息（不安全需要改进）
export const LoadOperators = () => {
    return request({
        url: '/User/EntityList',
        method: 'get'
    });
}

//加载公司
export const LoadCompany = () => {
    return request({
        url: '/Company/EntityList',
        method: 'get'
    });
}

//通过Code查询行政区划
export const QueryAdministrativeByCode = (parmas) => {
    return request({
        url: '/Administrative/QueryByCode',
        method: 'get',
        data: {"AdministrativeCode": parmas}
    });
} 

//通过Code查询公司
export const QueryCompanyByCode = (parmas) => {
    return request({
        url: '/Company/QueryByCode',
        method: 'get',
        data: {"CompanyCode": parmas}
    });
} 

//通过Code查询工程项目类型
export const QueryProjectTypeByCode = (parmas) => {
    return request({
        url: '/Company/QueryByCode',
        method: 'get',
        data: {"CompanyCode": parmas}
    });
}